package com.hehua.spring.demo1;

/**
 * @author W
 * 标准的模板方法模式(spring源码中学习而来)
 */
public abstract class AbstractEmailSend implements Email{



    private void check(String message){
        if ("鸡鸡".equals(message)){
            throw new RuntimeException("输入敏感词汇");
        }
    }

    protected abstract void doSend(String message);

    protected abstract String transfer(String message);

    @Override
    public void send(String message) {
        check(message);
        String transfer = transfer(message);
        doSend(transfer);
    }
}
